package main

import (
	"fmt"
	"log"
	"net/rpc"
)

// Operation 四则运输参数结构体
type Operation struct {
	Value1 int
	Value2 int
}

func main() {
	client, err := rpc.DialHTTP("tcp", "127.0.0.1:8080")
	if err != nil {
		log.Fatal("dialing:", err)
	}
	add := 0
	err = client.Call("Ans.Add", Operation{Value1: 10, Value2: 10}, &add)
	if err != nil {
		log.Fatal("add error:", err)
	}
	fmt.Printf("add: %d\n", add)
	div := 0
	err = client.Call("Ans.Division", Operation{Value1: 10, Value2: 10}, &div)
	if err != nil {
		log.Fatal("div error:", err)
	}
	fmt.Printf("div: %d\n", div)
}
